package com.hbnu.dao;

import com.hbnu.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

public interface UserMapper {
    @Insert("insert into tb_user(id,name,address) values(#{id},#{name},#{address})")
    int addUser(User user);

    @Insert("insert into tb_user(id,name,address) values(#{id},#{name},#{address})")
    int addUser1(Map<String,Object> map);

    @Insert("insert into tb_user values(#{arg0},#{arg1},#{arg2})")
    int addUser2(int id,String name,String address);

    @Insert("insert into tb_user values(#{param1},#{param2},#{param3})")
    int addUser3(int id,String name,String address);

    @Insert("insert into tb_user values(#{id},#{name},#{address})")
    int addUser4(@Param("id") int id, @Param("name") String name, @Param("addrsss") String address);

    @Delete("delete from tb_user where id = #{id}")
    int deleteUser(User user);

    @Update("update tb_user set address = #{address} where id = #{id}")
    int updateUser(User user);

    @Select("select * from tb_user")
    List<User> getUsers();

    @Select("select * from tb_user where id = #{id}")
    User getUserById(int id);

    @Select("select * from tb_user where ${column} = #{value}")
    List<User> findUserByColumn(@Param("column") String column,@Param("value") Object value);
}